<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.movie.Movie"%>
<%@page import="com.enterprise.web.*"%>
<%@page contentType="text/html"%>

<jsp:useBean id="ListMovies" class="com.assg2.dao.DaoMovie" />
<jsp:useBean id="Movie" class="com.movie.Movie" />

<%@include file="header.html"%>

<h3>Welcome to <b>Cinema World,</b> <span> This are the movies now showing</span></h3>



<%

    List<Movie> showing = ListMovies.listShowing();
    List<Movie> coming = ListMovies.listComing();


    out.println("<CENTER><h1>Showing</h1></CENTER>");
    for (int i = 0; i < showing.size(); i++) {
        Movie = showing.get(i);
        out.println("<CENTER><table width='700px'>");
        out.println("<tr>");
        out.println("<td colspan='2' height='50px'>");
        out.println("<CENTER><h1><a href='dispatcher?operation=movieinfo&movieid=" + Integer.toString(Movie.getIdmovie()) + "'>" + Movie.getTitle() + "</a></h1></CENTER>");
        out.println("</td>");
        out.println("</tr>");

        out.println("<tr>");

        out.println("<td valign='top'>");
        out.println("<CENTER><img width='100px' src='images/posters/" + Movie.getPoster() + "' /></CENTER>");
        out.println("</td>");


        out.println("<td valign='top'>");
        out.println("<CENTER><table width='550px'>");

        out.println("<tr>");
        out.println("<td >");
        out.println("<b>Rating: </b>" + Movie.getAgerating());
        out.println("</td>");
        out.println("</tr>");

        out.println("<tr>");
        out.println("<td>");
        out.println("<b>Director: </b>" + Movie.getDirector());
        out.println("</td>");
        out.println("</tr>");

        out.println("<tr>");
        out.println("<td align='justify'>");
        out.println("<b>Sypnosis: </b>" + Movie.getSynopsis());
        out.println("</td>");
        out.println("</tr>");

        out.println("<tr>");
        out.println("<td>");
        out.println("<b>Avg Review: </b>" + ListMovies.movierating(Movie.getIdmovie()));
        out.println("</td>");
        out.println("</tr>");
        
        out.println("</table></CENTER>");
        out.println("</td>");
        out.println("</tr>");

        out.println("</table></CENTER>");

    }

    out.println("<CENTER><h1>Coming</h1></CENTER>");
    for (int i = 0; i < coming.size(); i++) {
        Movie = coming.get(i);
        out.println("<CENTER><table width='700px'>");
        out.println("<tr>");
        out.println("<td colspan='2' height='50px'>");
        out.println("<CENTER><h1><a href='dispatcher?operation=movieinfo&movieid=" + Integer.toString(Movie.getIdmovie()) + "'>" + Movie.getTitle() + "</a></h1></CENTER>");
        out.println("</td>");
        out.println("</tr>");

        out.println("<tr>");

        out.println("<td valign='top'>");
        out.println("<img width='100px' src='images/posters/" + Movie.getPoster() + "' />");
        out.println("</td>");


        out.println("<td valign='top'>");
        out.println("<CENTER><table width='550px'>");

        out.println("<tr>");
        out.println("<td >");
        out.println("<b>Rating: </b>" + Movie.getAgerating());
        out.println("</td>");
        out.println("</tr>");

        out.println("<tr>");
        out.println("<td>");
        out.println("<b>Director: </b>" + Movie.getDirector());
        out.println("</td>");
        out.println("</tr>");

        out.println("<tr>");
        out.println("<td align='justify'>");
        out.println("<b>Sypnosis: </b>" + Movie.getSynopsis());
        out.println("</td>");
        out.println("</tr>");

        out.println("</table></CENTER>");
        out.println("</td>");
        out.println("</tr>");

        out.println("</table></CENTER>");

    }
%>
<%@include file="footer.html"%>
